package com.clk.services.impl;

import com.clk.dao.AdminMapper;
import com.clk.pojo.Admin;
import com.clk.services.AdminServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("adminService")
public class AdminServicesImpl implements AdminServices {
@Autowired

    private AdminMapper mapper;

    public Admin login(String userName, String pwd) {
        return mapper.login(userName,pwd);

    }

    public Integer updateLoginTimes(Integer id) {
        return mapper.updateLoginTimes(id);
    }

    public List<Admin> getAdminAll() {
        return mapper.getAdminAll();
    }

    public Admin getAdminByName(String userName) {
        return mapper.getAdminByName(userName);
    }

    public Boolean updateAdmin(Admin admin) {
        Integer res=mapper.updateAdmin(admin);
        if (res>0){
            return true;
        }
        return false;
    }

    public Boolean saveAdmin(Admin admin) {
        Integer res=mapper.saveAdmin(admin);
        if (res>0){
            return true;
        }
        return false;
    }

    public Boolean delAdmin(Integer id) {
        Integer res=mapper.delAdmin(id);
        if (res>0){
            return true;
        }
        return false;
    }
}
